<?php

namespace app\store\validate;

use think\Validate;

class IntegralSettingValidate extends Validate
{
    protected $rule = [
        'give_integral_scale' => 'require|integer',
        'integral_desc' => 'require|max:127',
        'is_sign_in' => 'require|in:0,1',
        'sign_in_integral' => 'require|gt:0',
        'integral_gold_scale' => 'require|integer',
        'gold_balance_scale' => 'require|float',
        'gold_desc' => 'require|max:127',
    ];

    protected $message = [
        'id.require' => '非法参数!',
        'integral_scale.require' => '积分赠送比例不能为空!',
        'integral_scale.integer' => '积分赠送比例必须为整数',
        'sign_in_integral.gt' => '积分赠送必须大于0',
        'integral_desc.require' => '请填写积分说明',
        'integral_desc.max' => '积分说明不能超过127个字符',
        'gold_redeem_scale.require' => '积分兑换金豆比列不能为空',
        'gold_desc.require' => '请填写金豆描述',
    ];


    public function sceneEdit()
    {
        return $this->only(['id','give_integral_scale','integral_desc','is_sign_in','sign_in_integral','sign_in_config','integral_gold_scale','gold_balance_scale','gold_desc'])->append('id','require');
    }
}